import java.util.Arrays;
import java.util.Collections;
/**
*输入两个矩形坐标（每个矩形只需输入三个点的坐标），计算矩形的重叠面积，结果保留整数（四舍五入），如：
*输入：0 0 100 0 0 50 50 25 200 25 50 80
*输出：1250
*/
public class Solution {
    static class Inner{
        private boolean ping;
        private double k1,k2,b1,b2,b3,b4;
        private double x1, y1, x2, y2, x3, y3;
        public Inner(double x1, double y1, double x2, double y2, double x3, double y3){
            if(x1 == x2 || x1 == x3){
                ping = true;
                this.x1 = x1;
                this.x2 = x2;
                this.x3 = x3;
                this.y1 = y1;
                this.y2 = y2;
                this.y3 = y3;
            }else {
                ping = false;
                k1 = (y1 - y2) / (x1 - x2);
                k2 = (y1 - y3) / (x1 - x3);
                b1 = y1 - k1 * x1;
                b2 = y3 - k1 * x3;
                b3 = y2 - k2 * x2;
                b4 = y1 - k2 * x1;
            }
        }

        public boolean innerp(double x, double y){
            if(ping){
                if((x>=x1 && x <= x2 && y>=y1 && y<=y3) ||
                        (x>=x1 && x <= x3 && y >= y1 && y<= y2)){
                    return true;
                }
            }else {
                if ((y <= (k1 * x + b2)) &&
                        (y >= (k1 * x + b1)) &&
                        (y >= (k2 * x + b4)) &&
                        (y <= (k2 * x + b3))) {
                    return true;
                }
            }

            return false;
        }
    }

    static double max(Double... x){
        return Collections.max(Arrays.asList(x));
    }

    static double min(Double... x){
        return Collections.min(Arrays.asList(x));
    }

    public static void main(String[] args) {
        double ax1 = Integer.valueOf(args[0]), ay1 = Integer.valueOf(args[1]);
        double ax2 = Integer.valueOf(args[2]), ay2 = Integer.valueOf(args[3]);
        double ax3 = Integer.valueOf(args[4]), ay3 = Integer.valueOf(args[5]);

        double bx1 = Integer.valueOf(args[6]), by1 = Integer.valueOf(args[7]);
        double bx2 = Integer.valueOf(args[8]), by2 = Integer.valueOf(args[9]);
        double bx3 = Integer.valueOf(args[10]), by3 = Integer.valueOf(args[11]);

        double maxX = max(ax1, ax2, ax3, bx1, bx2, bx3, ay1, ay2, ay3, by1, by2, by3);
        double mixX = min(ax1, ax2, ax3, bx1, bx2, bx3, ay1, ay2, ay3, by1, by2, by3);

        Inner inner1 = new Inner(bx1, by1, bx2, by2, bx3, by3);
        Inner inner2 = new Inner(ax1, ay1, ax2, ay2, ax3, ay3);
        long sum = 0;

        double precision = 0.01;
        for(double i = mixX; i <= maxX; i+=precision){
            for(double j = mixX; j <= maxX; j+=precision){
                if(inner1.innerp(i, j) && inner2.innerp(i, j)){
                    sum++;
                }
            }
        }
        System.out.println(Math.round(sum*precision*precision));
    }
}